#ifndef HTF_LOGGER_H
#define HTF_LOGGER_H

#include <stdio.h>

#define HTF_LOG_LEVEL_DEBUG 0
#define HTF_LOG_LEVEL_INFO  1
#define HTF_LOG_LEVEL_WARN  2
#define HTF_LOG_LEVEL_ERROR 3

#ifndef HTF_LOG_LEVEL
#define HTF_LOG_LEVEL HTF_LOG_LEVEL_INFO
#endif

#define HTF_LOG_DEBUG(fmt, ...) do { \
    if (HTF_LOG_LEVEL <= HTF_LOG_LEVEL_DEBUG) \
        fprintf(stderr, "[DEBUG] %s:%d: " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__); \
} while(0)

#define HTF_LOG_INFO(fmt, ...) do { \
    if (HTF_LOG_LEVEL <= HTF_LOG_LEVEL_INFO) \
        fprintf(stderr, "[INFO] " fmt "\n", ##__VA_ARGS__); \
} while(0)

#define HTF_LOG_WARN(fmt, ...) do { \
    if (HTF_LOG_LEVEL <= HTF_LOG_LEVEL_WARN) \
        fprintf(stderr, "[WARN] " fmt "\n", ##__VA_ARGS__); \
} while(0)

#define HTF_LOG_ERROR(fmt, ...) do { \
    if (HTF_LOG_LEVEL <= HTF_LOG_LEVEL_ERROR) \
        fprintf(stderr, "[ERROR] " fmt "\n", ##__VA_ARGS__); \
} while(0)

#endif